using Unity.VisualScripting;
using UnityGameFramework.Runtime;

namespace LS.UGFUnits
{
    [UnitSurtitle("Game Base")]
    [UnitShortTitle("Restart Game")]
    [UnitCategory("Unity Game Framework/Base")]
    public sealed class RestartGame : Unit
    {
        [DoNotSerialize]
        [PortLabelHidden]
        public ControlInput Input { get; set; }

        protected override void Definition()
        {
            Input = ControlInput(nameof(Input), In);
        }

        private ControlOutput In(Flow flow)
        {
            GameEntry.Shutdown(ShutdownType.Restart);
            return null;
        }
    }
}